// New data structure schema and overview


// KinectSkeleton creates and releases QSharedPointer<UserSkeleton>
class UserSkeleton {
public:
    enum UserJoint {
        RightShoulder = y,
        // etc...
    }
public:
    QVector3D userPosition(int userJoint) const;
    void setUserPosition(int userJoint, QVector3D position);
    
    QMatrix3x3 userOrientation(int userJoint) const;
    void setUserOrientation(int userJoint, QMatrix3x3 orientation);
    
    float userPositionConfidence(int userJoint) const;
    void setUserPositionConfidence(int userJoint, float conf);
    
    float userOrientationConfidence(int userJoint) const;
    void setUserOrientationConfidence(int userJoint, float conf);
}

class RobotSkeleton {
public:
    virtual float jointAngle(int channel) const = 0;
    virtual void setJointAngle(int channel, float theta) = 0;
};

// TroyMapper receives QSharedPointer<UserSkeleton>, builds both the raw and constrained skeletons,
// and then links the constrained skeleton to the raw and user skeletons.
// It then dispatches a QSharedPointer<TroySkeleton> with the constrained skeleton inside it, which
// can be copied and stored anywhere it is needed, and has access to the inner data still, right.
class TroySkeleton : public RobotSkeleton {
public:
    enum TroyJointChannel {
        RightShoulderForward = 0; //verify
        // etc...
    };
    enum TroyJoint {
        Torso,
        RightShoulder,
        RightElbow,
        RightHand,
        LeftShoulder,
        LeftElbow,
        LeftHand
        // etc.
    };
public:
    float jointAngle(int channel) const;
    void setJointAngle(int channel, float theta);
    
    QVector3D jointPosition(int joint) const;
    void setJointPosition(int joint, QVector3D position);
    
    bool hasRawSkeleton() const;
    QSharedPointer<TroySkeleton const> rawSkeleton() const;
    void setRawSkeleton(QSharedPointer<TroySkeleton const> skeleton);
    
    bool hasUserSkeleton() const;
    QSharedPointer<UserSkeleton const> userSkeleton() const;
    void setUserSkeleton(QSharedPointer<UserSkeleton const> skeleton);
private:
    QSharedPointer<TroySkeleton const> raw;
    QSharedPointer<UserSkeleton const> user;
};
